/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.report.mapper.statistics;

import com.koron.report.bean.StatisticsBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * 安全会议统计（特指法律法规规定的会议）
 */
public interface SafetyMeetingStatisticsMapper {

    /**
     * 统计
     * @param startDate
     * @param stopDate
     * @return
     */
    @Select("select a.corp_code AS code ,a.corp_name AS codeName , count(a.id) AS value " +
            "from safety_meeting a where a.add_time " +
            "between #{startDate} and #{stopDate} group by a.corp_code, a.corp_name")
    List<StatisticsBean> statistics(@Param("startDate") Date startDate, @Param("stopDate") Date stopDate);

    /**
     * 按集团统计
     * @param startDate
     * @param stopDate
     * @return
     */
    @Select("select count(a.id) AS value " +
            "from safety_meeting a where a.add_time " +
            "between #{startDate} and #{stopDate}")
    Integer statisticsBloc(@Param("startDate") Date startDate, @Param("stopDate") Date stopDate);
}
